<template>
	<view><!-- 组件的使用要只有一个根元素 -->
		<view class="test">
			<test :title="title" @myEven="getNum"></test><!-- 使用组件 -->
		</view>
		<view class="mine">
			mine
			<!-- 传递参数 -->
			<navigator url="/pages/mine/calendar?id=80&age=18">进入</navigator>
			<button type="primary" @click="goCalendar">进入</button>
		</view>
		<view class="test">
			<test-a></test-a>
			<test-b></test-b>
		</view>
	</view>
</template>

<script>
	import test from '../../components/test.vue' /* 引入组件 */
	import testA from '../../components/a.vue'
	import testB from '../../components/b.vue'
	export default {
		data(){
			return{
				title:'Hello'/* 父组件（main.vue)给子组件(test)传值(title) */
			}
		},
		onUnload() {
			/* 页面卸载时出发 */

		},
		methods: {
			goCalendar() {
				uni.navigateTo({
					url: '/pages/mine/calendar'
				})
			},
			getNum(num){
				console.log(num)
			}
		},
		components: {
			/* 注册组件 */
			test,
			"test-a":testA,
			"test-b":testB
		}
	}
</script>

<style>
</style>
